<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="../js/vue.js"></script>
</head>
<body>
    <div id="app">
        <p>{{counter}}</p>
        <!-- 在前端开发中，我们需要经常进行交互，需要事件监听 -->
        <button v-on:click="increase(123,$event)">+</button>
        <!-- v-on  语法糖简写@ -->
        <button @click="decrease">-</button>
        <!-- 如果执行的函数没有参数，不需要参数，可以省略参数；如果有参数，就放参数 -->
        <!-- 如果需要事件 -->
        <button v-on:click="increase">+</button>
        <button @click="counter--">-</button>
    </div>

    <script>
        let app =new Vue({
            el:"#app",
            data:{
                msg:'hello world',
                counter:0
            },
            methods:{
                increase(abc,event){
                    console.log(abc);
                    console.log(event);
                    this.counter++
                },
                decrease(){
                    this.counter--
                }
            }
        })
    </script>
    
</body>
</html>